﻿//Project: HTTPGET
//Martin CLAVREUIL
//martin@clavreuil.com

using System;
using System.Collections.Generic;
using System.Text;
using System.Net;

namespace HTTPGET
{
    class Program
    {
        static void Main(string[] args)
        {
            string desktop = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
            if (args.Length < 1)
            {
                Console.WriteLine(Languages.Languages.GetString("ERR_Usage"));
                Console.ReadLine();
            }
            else
            {
                foreach (string param in args)
                {
                    try
                    {
                        Console.WriteLine(Languages.Languages.GetString("INFO_Download"), param);
                        Uri fileurl = new Uri(param);
                        WebClient wc = new WebClient();
                        wc.DownloadFile(fileurl, desktop + "\\" + fileurl.Segments[fileurl.Segments.Length - 1]);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(Languages.Languages.GetString("ERR_Download"));
                        Console.WriteLine(ex.Message);
                    }
                }
            }
        }
    }
}
